<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = 'abcdacbabcbababcbabcabd'
        var arr = str.split("")
        
console.log(arr);
        var res = arr.reduce(function (pre, cur) {
            if (cur in pre) {
                pre[cur] += 1
            } else {
                pre[cur] = 1
            }
            return pre
        },{})
        for(var key in res){
            console.log(key+':'+res[key])
        }
        
    </script>
</body>
</html>